#!/bin/bash

##https://www.elastic.co/guide/en/kibana/current/docker.html
docker pull kibana:7.16.2

docker run --name kibana --restart=always \
-e "ELASTICSEARCH_HOSTS=http://elasticsearch:9200" \
--net mynet \
--ip 172.18.0.7 \
-p 5601:5601 -d kibana:7.16.2

elasticsearchPath=/opt/docker/elasticsearch
kibanaPath=$elasticsearchPath/kibana
kibanaSourceFile=kibana:/usr/share/kibana/config/kibana.yml
kibanaTargetFile=$kibanaPath/kibana.yml

mkdir -p $kibanaPath
docker cp $kibanaSourceFile $kibanaPath

cat >> $kibanaTargetFile <<EOF

i18n.locale: "zh-CN"
elasticsearch.username: "kibana"
elasticsearch.password: "123456"

EOF

docker cp $kibanaTargetFile $kibanaSourceFile
docker restart kibana

##http://192.168.202.10:5601

